        unit UFrmUsuarios;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, DBCtrls, StdCtrls, Mask, Buttons, Grids, Wwdbigrd, Wwdbgrid;

type
  TFrmUsuarios = class(TForm)
    Bevel1: TBevel;
    Bevel2: TBevel;
    Bevel3: TBevel;
    btnGravar: TSpeedButton;
    btnExcluir: TSpeedButton;
    btnAdicionar: TSpeedButton;
    btnRetornar: TSpeedButton;
    Label2: TLabel;
    DBEdit2: TDBEdit;
    Label1: TLabel;
    DBEdit1: TDBEdit;
    wwDBGrid1: TwwDBGrid;
    procedure btnPrimeiroClick(Sender: TObject);
    procedure btnAnteriorClick(Sender: TObject);
    procedure btnProximoClick(Sender: TObject);
    procedure btnUltimoClick(Sender: TObject);
    procedure btnGravarClick(Sender: TObject);
    procedure btnExcluirClick(Sender: TObject);
    procedure btnAdicionarClick(Sender: TObject);
    procedure btnRetornarClick(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure SpeedButton1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmUsuarios: TFrmUsuarios;

implementation

uses
   Modulo, Funcaos;

{$R *.DFM}

procedure TFrmUsuarios.btnPrimeiroClick(Sender: TObject);
begin
   DMEscola.QUsuario.First;
end;

procedure TFrmUsuarios.btnAnteriorClick(Sender: TObject);
begin
   DMEscola.QUsuario.Prior;
   if (DMEscola.QUsuario.Bof) then
      DMEscola.QUsuario.First;
end;

procedure TFrmUsuarios.btnProximoClick(Sender: TObject);
begin
   DMEscola.QUsuario.Next;
   if (DMEscola.QUsuario.Eof) then
      DMEscola.QUsuario.Last;
end;

procedure TFrmUsuarios.btnUltimoClick(Sender: TObject);
begin
   DMEscola.QUsuario.Last;
end;

procedure TFrmUsuarios.btnGravarClick(Sender: TObject);
begin
   DMEscola.QUsuario.Post;
   DMEscola.QUsuario.Edit;
end;

procedure TFrmUsuarios.btnExcluirClick(Sender: TObject);
begin
   DMEScola.QUsuario.Delete;
   DMEscola.QUsuario.Edit;
end;

procedure TFrmUsuarios.btnAdicionarClick(Sender: TObject);
begin
   DMEscola.QUsuario.Append;
   DMEscola.Qusuario.Edit;
   DBEdit2.Setfocus;
end;

procedure TFrmUsuarios.btnRetornarClick(Sender: TObject);
begin
   self.close;
end;

procedure TFrmUsuarios.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
If MessageDlg('Tem Certeza que desaja, sair do Cadastro de Usuários?', MtConfirmation, [mbyes, mbno], 0) = mrno then
   CanClose := False;
end;

procedure TFrmUsuarios.SpeedButton1Click(Sender: TObject);
begin
   DMEscola.QUsuario.Edit;
end;

procedure TFrmUsuarios.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
   Action := CaFree;
end;

procedure TFrmUsuarios.FormShow(Sender: TObject);
begin
   DMEscola.QUsuario.Edit;
end;

end.
